<!--
 * @Description  :
 * @Version      : 1.0
 * @Author       : Shiming
 * @Date         : 2021-12-28 14:42:03
 * @LastEditors  : Shiming
 * @LastEditTime : 2022-05-06 14:37:17
 * @FilePath     : \\tms-obc-web\\src\\app\\routes\\order-management\\components\\vehicle-detail\\vehicle-detail.component.html
 * Copyright (C) 2022 huzhenhong. All rights reserved.
-->
<page-header-wrapper [title]="'整车订单详情'" [logo]="logo">
  <ng-template #logo>
    <button nz-button nz-tooltip nzTooltipTitle="返回上一页" (click)="goBack()">
      <i nz-icon nzType="left" nzTheme="outline"></i>
    </button>
  </ng-template>
  <ng-template #headerContent>
    <div class="mb-xs common-order-header" nz-row>
      <div>
        <button nz-button nzType="primary" nzSize="small" nzDanger>{{ i?.billStatusLabel }}</button>
        <b class="ml-md" style="font-size: 18px">订单号: {{ i?.billCode }}</b>
      </div>
      <div>
        <button (click)="cancellation()" nz-button
          *ngIf="i.billStatus == '4' || i.billStatus == '5' || i.billStatus == '2' || i.billStatus == '3' || i.billStatus == '1'"
          acl [acl-ability]="['ORDER-VEHICLE-DETAIL-cancelAnOrder']">取消订单</button>
        <button nz-button (click)="changeOrder()"
          *ngIf="i.billStatus == '4' || i.billStatus == '5' || i.billStatus == '2' || i.billStatus == '3'" acl
          [acl-ability]="['ORDER-VEHICLE-DETAIL-modifyOrder']">修改订单</button>
      </div>
    </div>
    <div>
      <div sv-container>
        <sv label="网络货运人">{{ i?.goodsResource?.enterpriseInfoName }} </sv>
        <sv label="货主">{{ i?.goodsResource?.shipperAppUserName }} </sv>
        <sv label="所属项目">{{ i?.goodsResource?.enterpriseProjectName }}</sv>
        <sv label="服务类型">{{ i?.goodsResource?.serviceTypeLabel }}</sv>
        <sv label="录单员">{{ i?.createUserName }} {{ i?.createUserPhone ? '/' + i?.createUserPhone : '' }} </sv>
        <sv label="调度员">{{ i?.goodsResource?.dispatchName }}{{ i?.goodsResource?.dispatchPhone ? '/' +
          i?.goodsResource?.dispatchPhone : '' }}
        </sv>
        <sv label="外部订单号">{{ i?.externalBillCode }}</sv>
        <sv label="货源编号">{{ i?.goodsResource?.resourceCode }} </sv>
        <sv label="运单号">{{ i?.wayBill?.wayBillCode }}</sv>
        <sv label="承诺付款天数">{{ i?.goodsResource?.paymentDays }}</sv>
      </div>

      <nz-tabset style="margin-top: 15px">
        <nz-tab nzTitle="装卸货信息" (nzClick)="goDistance(distannce1)"> </nz-tab>
        <nz-tab nzTitle="基本信息" (nzClick)="goDistance(distannce2)"> </nz-tab>
        <nz-tab nzTitle="运费信息" (nzClick)="goDistance(distannce3)"> </nz-tab>
        <nz-tab nzTitle="附件信息" (nzClick)="goDistance(distannce4)"> </nz-tab>
        <nz-tab nzTitle="轨迹信息" (nzClick)="goDistance(distannce5)"> </nz-tab>
      </nz-tabset>
    </div>
  </ng-template>
</page-header-wrapper>
<nz-card [nzBorderless]="true" class="mb0" #distannce1>
  <div class="mb-xs common-order-header" nz-row>
    <div>
      <button nz-button nzType="primary" nzSize="small" nzDanger>{{ i?.billStatusLabel }}</button>
      <b class="ml-md" style="font-size: 18px">订单号: {{ i?.billCode }}</b>
    </div>
    <div>
      <button (click)="cancellation()" nz-button
        *ngIf="i.billStatus == '4' || i.billStatus == '5' || i.billStatus == '2' || i.billStatus == '3' || i.billStatus == '1'"
        acl [acl-ability]="['ORDER-VEHICLE-DETAIL-cancelAnOrder']">取消订单</button>
      <button nz-button (click)="changeOrder()"
        *ngIf="i.billStatus == '4' || i.billStatus == '5' || i.billStatus == '2' || i.billStatus == '3'" acl
        [acl-ability]="['ORDER-VEHICLE-DETAIL-modifyOrder']">修改订单</button>
    </div>
  </div>
  <nz-divider class="divider-margin"></nz-divider>
  <div>
    <div class="mb-lg" sv-container>
      <sv label="网络货运人">{{ i?.goodsResource?.enterpriseInfoName }} </sv>
      <sv label="货主">{{ i?.goodsResource?.shipperAppUserName }} </sv>
      <sv label="所属项目">{{ i?.goodsResource?.enterpriseProjectName }}</sv>
      <sv label="服务类型">{{ i?.goodsResource?.serviceTypeLabel }}</sv>
      <sv label="录单员">{{ i?.createUserName }} {{ i?.createUserPhone ? '/' + i?.createUserPhone : '' }} </sv>
      <sv label="调度员">{{ i?.goodsResource?.dispatchName }}{{ i?.goodsResource?.dispatchPhone ? '/' +
        i?.goodsResource?.dispatchPhone : '' }}
      </sv>
      <sv label="外部订单号">{{ i?.externalBillCode }}</sv>
      <sv label="货源编号">{{ i?.goodsResource?.resourceCode }} </sv>
      <sv label="运单号">{{ i?.wayBill?.wayBillCode }}</sv>
      <sv label="承诺付款天数">{{ i?.goodsResource?.paymentDays }}</sv>
    </div>
  </div>
  <div class="approval-status">
    <div class="step-row">
      <nz-steps [nzCurrent]="i?.scheduleVOList?.length + 1" nzLabelPlacement="vertical">
        <nz-step *ngFor="let item of i?.scheduleVOList" [nzTitle]="item.state" [nzSubtitle]="item.stateTime"
          [nzDescription]="item.cancelReason ? '取消原因：' + item.cancelReason : ''"
          [nzStatus]="item.displayStatus === 'SHOW' ? 'finish' : 'wait'"></nz-step>
      </nz-steps>
    </div>
  </div>
</nz-card>
<nz-card [nzBorderless]="true" class="mb0">
  <!-- <h4 class="text-md">装货卸货信息
      <span class="ml-sm text-sm">(
        <label>{{ i?.loadingCount }}装</label>
        <label>{{ i?.unloadingCount }}卸</label>
        )
      </span>
    </h4> -->
  <div class="font-weight-blod text-md detail-title">
    <a class="sign"></a>
    <span>装货卸货信息</span>
    <span class="ml-sm text-sm">(
      <label>{{ i?.loadingCount }}装</label>
      <label>{{ i?.unloadingCount }}卸</label>
      )
    </span>
  </div>
  <div nz-row [nzGutter]="24">
    <div class="handling-col" nz-col [nzSpan]="12">
      <div class="handling-info p-md">
        <ng-container *ngFor="let item of i?.unLoadingPlaceList">
          <div class="flex" *ngIf="item.type === '1'">
            <div class="loading-row">
              <div class="handling-info-icon loading-bg">装</div>
              <div class="info">
                <h4>装货地：{{ item?.province }}{{ item.city }}{{ item.area }}{{ item.detailedAddress }}</h4>
                <p>联系人：{{ item.appUserName }}{{ item.contractTelephone ? '/' + item.contractTelephone : '' }}</p>
              </div>
            </div>
          </div>
        </ng-container>
        <p class="time-info mb0">计划装货时间：{{ i?.goodsResource?.loadingTime }}</p>
      </div>
    </div>
    <div class="handling-col" nz-col [nzSpan]="12">
      <div class="handling-info p-md">
        <ng-container *ngFor="let item of i?.unLoadingPlaceList">
          <div class="flex" *ngIf="item.type === '2'">
            <div class="loading-row">
              <div class="handling-info-icon unloaing-bg">卸</div>
              <div class="info">
                <h4>卸货地：{{ item?.province }}{{ item.city }}{{ item.area }}{{ item.detailedAddress }}</h4>
                <p>联系人：{{ item.appUserName }}{{ item.contractTelephone ? '/' + item.contractTelephone : '' }}</p>
              </div>
            </div>
          </div>
        </ng-container>
        <p class="time-info mb0">计划卸货时间：{{ i?.goodsResource?.unloadingTime }}</p>
      </div>
    </div>
  </div>
</nz-card>
<nz-card [nzBorderless]="true" class="mb0" #distannce2>
  <div class="font-weight-blod text-md detail-title">
    <a class="sign"></a>
    <span>基本信息</span>
  </div>
  <sv-container col="3">
    <!-- <sv-title>货物信息</sv-title> -->
    <sv label="网络货运人">
      {{ i?.goodsResource?.enterpriseInfoName }}
    </sv>
    <sv label="货物名称">
      {{i?.goodsInfoList?.[0]?.goodsName}}
    </sv>
    <sv label="货物数量">
      {{i?.goodsInfoList?.[0]?.weight}}吨,{{i?.goodsInfoList?.[0]?.volume}}方,{{i?.goodsInfoList?.[0]?.number}}件 </sv>
    <sv label="用车需求">{{ i?.carModel }}{{ i?.carLength ? '/' + i?.carLength : '' }}</sv>
    <sv label="承运司机"> {{ i?.driverName }}{{ i?.driverPhone ? '/' + i?.driverPhone : '' }}{{ i?.carNo ? '/' + i?.carNo :
      '' }} </sv>
    <sv label="车型车长载重"> {{ i?.driverCarModelLabel }},{{ i?.driverCarLengthLabel }}米,{{ i?.driverCarWeight }}吨 </sv>
  </sv-container>

</nz-card>
<nz-card [nzBorderless]="true" class="mb0">
  <div class="font-weight-blod text-md detail-title">
    <a class="sign"></a>
    <span>服务信息</span>
  </div>
  <sv-container>
    <sv label="服务包">
      {{ i?.goodsResource?.insuranceTypeLabel }}
    </sv>
    <sv label="货物价值">
      {{ i?.goodsResource?.goodsValue !== null ? (i?.goodsResource?.goodsValue | currency) + '元' : '-' }}
    </sv>
    <sv label="服务包费用">
      {{ i?.goodsResource?.insurancePremium !== null ? (i?.goodsResource?.insurancePremium | currency) + '元' : '-' }}
    </sv>
  </sv-container>
</nz-card>

<nz-card [nzBorderless]="true" class="mb0" #distannce3>
  <div class="font-weight-blod text-md detail-title">
    <a class="sign"></a>
    <span>运费信息</span>
  </div>
  <st #st [data]="billExpenses" [columns]="logColumns" [ps]="0" [page]="{ show: false, showSize: false }"
    [size]="'small'">
    <ng-template st-row="price" let-item let-index="index">
      {{ item.price | currency }}
    </ng-template>
    <ng-template st-row="prices" let-item let-index="index">
      {{ item.price + item.surcharge | currency }}
    </ng-template>
    <ng-template st-row="surcharge" let-item let-index="index">
      {{ item.surcharge | currency }}
    </ng-template>
  </st>
  <div>
    总计：<span style="color: #da001b; font-size: 18px">{{ i?.totalAmount | currency }}</span> （运费{{ i?.totalFreight |
    currency }}，
    附加费{{ i?.totalSurcharge | currency }}，附加费率{{ (i?.totalRate * 100).toFixed(2) }}% ）
  </div>
  <div *ngIf="i?.payeePhone && i?.payeePhone !== i?.driverPhone">车队长：{{ i?.payeeName }}{{ i?.payeePhone ? '/' +
    i?.payeePhone : '' }}/{{ i?.payeeIdNo }}</div>
</nz-card>

<div nz-row>
  <div nzSpan="12" nz-col>
    <nz-card [nzBorderless]="true" class="mb0 attch-card" #distannce4>
      <div class="font-weight-blod text-md detail-title">
        <a class="sign"></a>
        <span>附件信息</span>
      </div>
      <div class="attachment-info">
        <sv-container>
          <sv label="协议附件" col="1">
            <a *ngIf="i?.contractContent?.contractContent" (click)="agreement('1')">查看附件</a> &nbsp;&nbsp;&nbsp;&nbsp;
            <a *ngIf="i?.supplementContent?.contractContent" (click)="agreement('2')">补充协议</a>
          </sv>
        </sv-container>
        <sv-container col="2" class="mt-md" layout="vertical">
          <sv label="装货凭证">
            <app-imagelist *ngIf="i?.loadingLadingBillFilePath|| i?.loadingPeopleVehiclesGoodsFilePath"
              [imgList]="[i?.loadingLadingBillFilePath, i?.loadingPeopleVehiclesGoodsFilePath]"
              [style]="'width:120px;height:120px;'">
            </app-imagelist>
          </sv>
          <sv label="卸货凭证">
            <app-imagelist *ngIf="i?.unloadingLadingBillFilePath || i?.unloadingPeopleVehiclesGoodsFilePath"
              [imgList]="[i?.unloadingLadingBillFilePath, i?.unloadingPeopleVehiclesGoodsFilePath]"
              [style]="'width:120px;height:120px;'">
            </app-imagelist>
          </sv>
        </sv-container>
      </div>
    </nz-card>
  </div>
  <div nzSpan="12" nz-col>
    <nz-card [nzBorderless]="true" class="mb0 attch-card">
      <div class="font-weight-blod text-md detail-title">
        <a class="sign"></a>
        <span>补充信息</span>
      </div>
      <div class="attachment-info">
        <sv-container col="1">
          <sv label="是否回单">
            {{ i?.supplementaryInformationVO?.stateReceipt ? '是' : '否' }}
          </sv>
          <sv label="回单类型" *ngIf="i?.supplementaryInformationVO?.stateReceipt">
            {{ i?.supplementaryInformationVO?.receiptType === '1' ? '电子回单' : '纸质回单' }}
          </sv>
          <ng-container
            *ngIf="i?.supplementaryInformationVO?.stateReceipt && i?.supplementaryInformationVO?.receiptType==='2'">
            <sv label=" 联系人" *ngIf="i?.supplementaryInformationVO?.stateReceipt">
              {{ i?.supplementaryInformationVO?.receiptUserName }} / {{ i?.supplementaryInformationVO?.phon }}
            </sv>
            <sv label="所在地区" *ngIf="i?.supplementaryInformationVO?.stateReceipt">
              {{ i?.supplementaryInformationVO?.area }}
            </sv>
            <sv label="详细地址" *ngIf="i?.supplementaryInformationVO?.stateReceipt">
              {{ i?.supplementaryInformationVO?.address }}
            </sv>
          </ng-container>
          <sv label="备注">
            {{ i?.goodsResource?.remarks }}
          </sv>
          <sv label="回单凭证" *ngIf="i?.supplementaryInformationVO?.stateReceipt">
            <app-imagelist [imgList]="i?.receiptFilePath" [style]="'width:120px;height:120px;'"></app-imagelist>
          </sv>
        </sv-container>
      </div>
    </nz-card>
  </div>
</div>

<nz-card [nzBorderless]="true" class="mb0" #distannce5>
  <div nz-row>
    <p class="detail_title"><span>|</span> 轨迹信息</p>
    <!-- <button style="margin-left: 15px;" nz-button nzSize="small" nzType="primary" (click)="restMap()" [disabled]="">刷新</button>
    <button style="margin-left: 15px;" nz-button nzSize="small" nzType="primary" (click)="regetMap()" [disabled]="">重新获取轨迹</button> -->
  </div>
  <div nz-row>
    <div nz-col [nzSpan]="24">
      <amap-path-simplifier [mapWidth]="'100%'" [mapHeight]="'300px'" [mapList]="mapList" [pois]="pois">
      </amap-path-simplifier>
      <st [scroll]="{ y: '350px' }" #st [data]="addressItems" [columns]="logColumns2" [noResult]='fuck' [ps]="0"
        [page]="{ show: false, showSize: false }" size="small" class="map_st">
        <ng-template #fuck>
          <div>
            <img class="mr-sm" [src]="'../../../../../assets/none.svg'" width="40" height="40" />
          </div>
          暂无停车信息
        </ng-template>
      </st>
      <nz-radio-group [(ngModel)]="trajectory" (ngModelChange)="trajectoryChange($event)" class="map_radio">
        <label nz-radio-button nzValue="car">车辆轨迹</label>
        <label nz-radio-button nzValue="driver">司机轨迹</label>
      </nz-radio-group>
    </div>
  </div>
</nz-card>

<nz-card [nzBorderless]="true" class="mb0">
  <nz-tabset>
    <nz-tab nzTitle="风险异常检测">
      <div *ngIf="abnormalList.length > 0">
        <div> 您的订单可能存在交易风险，请及时提交申诉材料，提交成功后，平台将及时完成审核并通知您! </div>
        <div>如果您的运单没有问题，可以提出申诉，并提供相关资料，我们将24小时内审核反馈</div>
        <ul *ngFor="let item of abnormalList">
          <li style="color: red;">系统识别:{{ item?.complianceName }}</li>
          <li style="color: red;">{{ item?.determineDetails }}</li>
        </ul>
      </div>
    </nz-tab>
    <nz-tab nzTitle="异常预警">
      <st #st [data]="service.$api_get_order_abnormalWarning" [columns]="logColumns3"
        [res]="{ reName: { list: 'data' } }" [req]="{params:{id:route.snapshot.params.id}}"
        [page]="{ show: false, showSize: false }"> </st>
    </nz-tab>
    <nz-tab nzTitle="操作日志">
      <!-- <st #logSt [data]="service.$api_get_log_list" [columns]="operateLogColums"
      [req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: logParams ,lazyLoad:true}"
      [res]="{ reName: { list: 'data.records', total: 'data.total' } }">
      <ng-template st-row="operator" let-item>
        {{item?.operator}}/{{item.telephone}}
      </ng-template>
    </st> -->
      <app-logistics-time-line [data]="operationList"></app-logistics-time-line>

    </nz-tab>
  </nz-tabset>
</nz-card>
<nz-modal [(nzVisible)]="isVisible" nzWidth="1000px" [nzFooter]="nzModalFooter" [nzTitle]="modalTitle"
  (nzOnOk)="handleOK()" (nzOnCancel)="handleCancel()">
  <ng-container *nzModalContent>
    <div *ngIf="!modalcontent">暂无附件信息</div>
    <div [innerHTML]="modalcontent"></div>
  </ng-container>
  <ng-template #nzModalFooter>
    <button nz-button nzType="primary" (click)="handleOK()" [disabled]="">取消</button>
    <button nz-button nzType="default" (click)="handleCancel()">确定 </button>
  </ng-template>
</nz-modal>
